package com.xzx.masterslave.masterslave.controller;

import com.xzx.masterslave.masterslave.entity.UserInfo;
import com.xzx.masterslave.masterslave.service.UserInforService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserInfoController {

    @Autowired
    private UserInforService inforService;

    @RequestMapping("/add")
    @ResponseBody
    public String addTest() {
        inforService.add();
        return "add测试";
    }

    @RequestMapping("/query/{id}")
    @ResponseBody
    public UserInfo queryById(@PathVariable("id")Integer id){
        UserInfo userInfo = inforService.queryById(id);
        return userInfo;
    }

    @RequestMapping("/updateandquery/{id}")
    @ResponseBody
    public UserInfo updateAndQuery(@PathVariable("id") Integer id) {
        UserInfo userInfo = inforService.updateAndQuery(id);
        return userInfo;
    }





}
